import request from '@utils/request';
import { service } from '@/utils/service'


export async function getProjectList() {
  return request(`${service.SERVICE_ROOT}/project/list`, );
}

export async function asyncDatabase(params:any) {
  return request(`${service.SERVICE_ROOT}/project/asyncDatabase`,{
    method: 'POST',
    data: {
      ...params,
    },
  })
}

export async function projectDetail(id:any) {
  return request(`${service.SERVICE_ROOT}/project/detail?id=${id}`, );
}

export async function projectUpdate(params:any) {
  return request(`${service.SERVICE_ROOT}/project/update`,{
    method: 'PUT',
    data: {
      ...params,
    },
  })
}

export async function insertProject(params:any) {
  return request(`${service.SERVICE_ROOT}/project/insert`,{
    method: 'POST',
    data: {
      ...params,
    },
  })
}

export async function deleteProject(params:any) {
  return request(`${service.SERVICE_ROOT}/project/delete`,{
    method: 'DELETE',
    data: {
      ...params,
    },
  })
}

export async function fetchProjectFileTreeApi(projectId:any) {
  return request(`${service.SERVICE_ROOT}/project/treeStructure?projectId=${projectId}`,)
}

export async function genProject(params:any) {
  return request(`${service.SERVICE_ROOT}/project/genProject`,{
    method: 'POST',
    data: {
      ...params,
    },
  })
}
